<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/5/18
  Time: 15:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>springMvc学习</title>
    <script src="js/jquery.min.js"></script>
    <script>
        // 页面加载，绑定单击事件
        $(function(){
            $("#btn").click(function(){
                alert("hello btn");
                // 发送ajax请求
                $.ajax({
                    // 编写json格式，设置属性和值
                    url:"hi/unSync",
                    contentType:"application/json;charset=UTF-8",
                    data:'{"name":"hehe","age":30}',
                    dataType:"json",
                    type:"post",
                    success:function(data){
                        // data服务器端响应的json的数据，进行解析
                        alert(data);
                        alert(data.name);
                        alert(data.age);
                    }
                });

            });
        });

    </script>
</head>
<body>
    <a href="hi/testModel">测试model</a>
    <br/>
    <a href="hi/testModelView">test ModelAndView</a>
    <br/>
    <a href="hi/testRedirectForward">test Redirect Forward</a>
    <br/>
    <button id="btn">发送请求</button>
    <br/>
    <a href="hi/lanjie">test 拦截器</a>
</body>
</html>
